package org.egomsl.mw.mapreduce;

import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableUtils;
import org.apache.hadoop.mapreduce.InputSplit;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class ABaseInputSplit extends InputSplit implements Writable {
    private String regionDir;

    public ABaseInputSplit() {
        regionDir = null;
    }
    public ABaseInputSplit(String regionDir) {
        this.regionDir = regionDir;
    }

    public String getRegionDir() {
        return regionDir;
    }

    @Override
    public long getLength() throws IOException, InterruptedException {
        return 0;
    }

    @Override
    public String[] getLocations() throws IOException, InterruptedException {
        return new String[0];
    }

    public void readFields(DataInput in) throws IOException {
        this.regionDir = WritableUtils.readString(in);
    }

    public void write(DataOutput out) throws IOException {
        WritableUtils.writeString(out, regionDir);
    }
}
